package com.xiaoyu.lanling.feature.privilege.data

import com.xiaoyu.base.net.RequestCreator
import com.xiaoyu.lanling.common.config.HttpConfig
import com.xiaoyu.lanling.event.privilege.PrivilegeSettingEvent
import com.xiaoyu.lanling.event.privilege.PrivilegeSettingSyncEvent

object PrivilegeSetting {

    const val PARAM_YES = "yes"
    const val PARAM_NO = "no"

    fun setPrivilege(requestTag: Any, hideDistance: Boolean, hideVisit: Boolean) {
        RequestCreator.create<PrivilegeSettingEvent>(requestTag, PrivilegeSettingEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_SET_VIP_SETTING)
                .addPostData("hideDistance", if (hideDistance) PARAM_YES else PARAM_NO)
                .addPostData("hideVisit", if (hideVisit) PARAM_YES else PARAM_NO)
                .enqueue()
    }

    fun getPrivilegeSetting(requestTag: Any) {
        RequestCreator.create<PrivilegeSettingSyncEvent>(requestTag, PrivilegeSettingSyncEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_GET_VIP_SETTING)
                .enqueue()
    }
}